//
//  HomePageViewCell.m
//  TeamInformatization
//
//  Created by bigger on 2019/3/31.
//  Copyright © 2019年 SPIC. All rights reserved.
//

#import "HomePageViewCell.h"

@interface HomePageViewCell ()

// 标题
@property (nonatomic, strong) SimpleLabel *newsTitle;
// 简介
@property (nonatomic, strong) SimpleLabel *neswDesc;
// 图片
@property (nonatomic, strong) UIImageView *newsImageView;

@end


@implementation HomePageViewCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatCellView];
        
        self.backgroundColor = [UIColor whiteColor];
        // 取消cell选中状态
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
}

- (void)creatCellView
{
    self.newsTitle = [SimpleLabel initWithText:@"" TextColor:kTitleTextColor TextFont:[UIFont boldSystemFontOfSize:17] TextAlignment:NSTextAlignmentLeft];
    [self addSubview:_newsTitle];
    [_newsTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15 * kScaleWidth);
        make.top.mas_equalTo(15 * kScaleWidth);
        make.width.mas_equalTo(kScreenWidth - 145 * kScaleWidth);
    }];
    
    self.neswDesc = [SimpleLabel initWithText:@"" TextColor:kSubTitleTextColor TextFont:[UIFont systemFontOfSize:12] TextAlignment:NSTextAlignmentLeft];
    _neswDesc.numberOfLines = 2;
    [self addSubview:_neswDesc];
    [_neswDesc mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.newsTitle.mas_bottom).offset(5 * kScaleWidth);
        make.left.mas_equalTo(self.newsTitle.mas_left);
        make.width.mas_equalTo(self.newsTitle);
    }];
    
    
    self.newsImageView = [[UIImageView alloc] init];
    [self addSubview:_newsImageView];
    [_newsImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.newsTitle.mas_top);
        make.right.mas_equalTo(-15 * kScaleWidth);
        make.size.mas_equalTo(CGSizeMake(111 * kScaleWidth, 74 * kScaleWidth));
    }];
    
}

// 赋值
- (void)setShowViewCellWithNewsData:(NewsData *)newsData
{
    _newsTitle.text = @"公司召开一届三次会暨会议";
    [_neswDesc setText:@"部署2019年的重要战略部署2019年的重要战略部署2019年的重要战略部署2019年的重要战略" lineSpacing:8];
    
    [_newsImageView sd_setImageWithURL:[NSURL URLWithString:@""] placeholderImage:[UIImage imageNamed:@"分组 25"]];
    
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
